# Contributor: Holger Jaekel <holger.jaekel@gmx.de>
# Maintainer: Holger Jaekel <holger.jaekel@gmx.de>
pkgname=kealib
pkgver=1.5.2
pkgrel=0
pkgdesc="KEA is an image file format that provides a full implementation of the GDAL data model"
url="http://www.kealib.org/"
arch="all"
license="MIT"
makedepends="
	cmake
	hdf5-dev
	samurai
	"
subpackages="
	$pkgname-dev
	"
source="
	https://github.com/ubarsc/kealib/releases/download/kealib-$pkgver/kealib-$pkgver.tar.gz
	10-config-shell.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d039ed460b5f0b86ee79b3a873c6f497412fedd9734aaf11a0972c7e3be0ee85cdda9a701d278894b884d80ce0f12094d9f95b6a97dedc2cfb4d9cfec8cdafbd  kealib-1.5.2.tar.gz
fe77138269e4b0f375d1d670fd41661784d59bf8eaaea5339bd95e669bee07ff81ca7a50798981ced7ffbd6f480e2e36801e2e580d298b864acc85b7864735c3  10-config-shell.patch
"
